<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="assets/js/jquery-1.8.0.min.js"></script>
</head>
<body>

<!-- i18n展示 -->
<div>
 Language: <a href="?lang=zh_CN"><spring:message code="language.cn" /></a> - <a href="?lang=en_US"><spring:message code="language.en" /></a>
    <h2>
        <spring:message code="welcome" />
    </h2>
</div>

 <table>
 <tr><td><label>账号:</label><input id="userName" name="userName" maxLength="40"/></td></tr>
 <tr><td><label>密码：</label><input id="password" title="密码" type="password" name="password" /></td></tr>
 <tr><td><label>验证码：</label><input id="captcha" title="验证码" type="text" name="captcha" /></td><td><img src="kaptcha.jpg" alt="换一张" onclick="this.src='kaptcha.jpg?d='+new Date().getTime()" /></td></tr>
 <tr><td><input type="button" id="submitButton" value="登录"/></td></tr>
 </table>
</body>
<script type="text/javascript">
	$("#submitButton").click(function(){
		var loginname = $("#userName").val();
		var password = $("#password").val();
		var captcha = $("#captcha").val();
		
		var params = {
				"userName" : loginname,
				"password" : password,
				"captcha" : captcha
			};
		$.post("userLogin", params, function(data) {
			if(data.res){
				window.location.href="main";
			}else{
				alert(data.msg);
			}
		});
	});
</script>
</html>